package com.ql.boot.dubbo.provider;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.ql.boot.dubbo.api.DemoProvider;
import com.ql.boot.dubbo.entity.Demo;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * 注意：@Component注解是为了让spring扫描到此类，也可以用spring的@Service代替，不能仅写Dubbo的@Service注解，可以通过修改dubbo源码解决
 */
@Component
@Service(interfaceClass = DemoProvider.class, protocol = "dubbo", version = "1.0")
public class DemoProviderImp implements DemoProvider {

    public Integer addDemo(String name) {
        return null;
    }

    public Demo getById(Integer id) {
        System.out.println("进来服务了...");
        Demo demo = new Demo();
        demo.setId(id);
        demo.setName("demo" + id);
        demo.setCreateTime(new Date());
        return demo;
    }

    public List getList(String name) {
        return null;
    }
}
